import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';

@Injectable({ providedIn: 'root' })

export class UpdateMessageService {
  private subject = new Subject<any>();

  sendMessage(changed: string) {
    this.subject.next({ changed });
  }

  clearMessage() {
    this.subject.next(null);
  }

  getMessage(): Observable<string> {
    return this.subject.asObservable();
  }
}
